<template>
  <div>
    <el-breadcrumb separator="/" style="height:10px;">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>系统管理</el-breadcrumb-item>
        <el-breadcrumb-item>建议管理</el-breadcrumb-item>
      </el-breadcrumb>
     <el-table
      :data="suggestList"
      border
      style="width: 100%">
      <el-table-column
        prop="sid"
        label="序号"
        width="180">
      </el-table-column>

      <el-table-column
        prop="scontent"
        label="建议内容"
        width="180">
      </el-table-column>

      <el-table-column
        prop="stime"
        label="时间"
        width="180">
      </el-table-column>

      <el-table-column
        prop="sperson"
        label="建议人"
        width="180">
      </el-table-column>

      <el-table-column label="管理操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="info"
            @click="delSuggest(scope.row.sid)">删除</el-button>
        </template>
        </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {findAllguest,delBysid} from '../../api'
export default {
  data() {
    return {
      suggestList : []
    }
  },
  created() {
    this.findAll()
  },
  methods: {
    async findAll(){
      let {data:baseRefault} = await findAllguest()
      this.suggestList = baseRefault.data
    },
    delSuggest(sid){
      this.$confirm('删除改条建议, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(async () => {
            let {data:baseRefault} = await delBysid(sid)
            this.$message.success(baseRefault.message)
            this.findAll()
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除建议'
          });          
        });
    }
  },
}
</script>

<style>

</style>